<template>
  <div id="product_details">
    <i class="el-icon-back" @click="detailsBack"></i>
    <div class="container">
      <el-row :gutter="20">
      <el-col :span="2"><div>产品名称:</div></el-col>
      <el-col :span="6"><div>{{ details.name }}</div></el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :span="2"><div>产品价格:</div></el-col>
      <el-col :span="6"><div>{{ details.price }}</div></el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :span="2"><div>产品描述:</div></el-col>
      <el-col :span="6"><div>{{ details.description }}</div></el-col>
    </el-row>  
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      details: [],
    };
  },
  created() {
    // alert(this.$route.query.id);
    this.$axios
      .get("/product/findById", {
        params: {
          id: this.$route.query.id,
        },
      })
      .then((response) => {
        this.details = response.data.data;
      });
  },
  methods: {
    detailsBack(){
      this.$router.go(-2);
    }
  }
};
</script>

<style lang="scss" scoped>
#product_details {
  padding: 20px;
}
#product_details i {
  font-size: 30px;
  color: #409EFF;
}
.container {
  margin-top: 15px;
}
.container .el-row {
  padding-bottom: 10px
}
</style>